package com.yiwei.zxp.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.yiwei.zxp.R;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class GoodsDetailAdapter extends ItemAdapter<String, GoodsDetailAdapter.DefaultHolder> {


    private Context context;

    public GoodsDetailAdapter(Context context) {
        super(context);
        this.context = context;
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_goods_detail_image, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        Glide.with(context).load(getItem(position)).placeholder(R.color.image_default).into(holder.imgImage);
    }

    class DefaultHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.img_image)
        ImageView imgImage;

        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
